YES 0.7030000000000001
H-Termination proof of /home/matraf/haskell/eval_FullyBlown_Fast/Monad.hs
H-Termination of the given Haskell-Program with start terms could successfully be proven:
↳ HASKELL
↳ LR
mainModule Monad
| ((filterM :: (a -> Maybe Bool) -> [a] -> Maybe [a]) :: (a -> Maybe Bool) -> [a] -> Maybe [a]) |
module Monad where
| import qualified Maybe import qualified Prelude
|
| filterM :: Monad a => (b -> a Bool) -> [b] -> a [b]
filterM | _ [] | = | return [] |
filterM | p (x : xs) | = | p x >>= (\flg ->filterM p xs >>= (\ys ->return ( if flg then x : ys else ys))) |
|
module Maybe where
| import qualified Monad import qualified Prelude
|
Lambda Reductions:
The following Lambda expression
\ys→return (if flg then x : ys else ys)
is transformed to
filterM0 | flg x ys | = return (if flg then x : ys else ys) |
The following Lambda expression
\flg→filterM p xs >>= filterM0 flg x
is transformed to
filterM1 | p xs x flg | = filterM p xs >>= filterM0 flg x |
↳ HASKELL
↳ LR
↳ HASKELL
↳ IFR
mainModule Monad
| ((filterM :: (a -> Maybe Bool) -> [a] -> Maybe [a]) :: (a -> Maybe Bool) -> [a] -> Maybe [a]) |
module Maybe where
| import qualified Monad import qualified Prelude
|
module Monad where
| import qualified Maybe import qualified Prelude
|
| filterM :: Monad b => (a -> b Bool) -> [a] -> b [a]
filterM | _ [] | = | return [] |
filterM | p (x : xs) | = | p x >>= filterM1 p xs x |
|
|
filterM0 | flg x ys | = | return ( if flg then x : ys else ys) |
|
|
filterM1 | p xs x flg | = | filterM p xs >>= filterM0 flg x |
|
If Reductions:
The following If expression
if flg then x : ys else ys
is transformed to
filterM00 | x ys True | = x : ys |
filterM00 | x ys False | = ys |
↳ HASKELL
↳ LR
↳ HASKELL
↳ IFR
↳ HASKELL
↳ BR
mainModule Monad
| ((filterM :: (a -> Maybe Bool) -> [a] -> Maybe [a]) :: (a -> Maybe Bool) -> [a] -> Maybe [a]) |
module Monad where
| import qualified Maybe import qualified Prelude
|
| filterM :: Monad b => (a -> b Bool) -> [a] -> b [a]
filterM | _ [] | = | return [] |
filterM | p (x : xs) | = | p x >>= filterM1 p xs x |
|
|
filterM0 | flg x ys | = | return (filterM00 x ys flg) |
|
|
filterM00 | x ys True | = | x : ys |
filterM00 | x ys False | = | ys |
|
|
filterM1 | p xs x flg | = | filterM p xs >>= filterM0 flg x |
|
module Maybe where
| import qualified Monad import qualified Prelude
|
Replaced joker patterns by fresh variables and removed binding patterns.
↳ HASKELL
↳ LR
↳ HASKELL
↳ IFR
↳ HASKELL
↳ BR
↳ HASKELL
↳ COR
mainModule Monad
| ((filterM :: (a -> Maybe Bool) -> [a] -> Maybe [a]) :: (a -> Maybe Bool) -> [a] -> Maybe [a]) |
module Maybe where
| import qualified Monad import qualified Prelude
|
module Monad where
| import qualified Maybe import qualified Prelude
|
| filterM :: Monad a => (b -> a Bool) -> [b] -> a [b]
filterM | vw [] | = | return [] |
filterM | p (x : xs) | = | p x >>= filterM1 p xs x |
|
|
filterM0 | flg x ys | = | return (filterM00 x ys flg) |
|
|
filterM00 | x ys True | = | x : ys |
filterM00 | x ys False | = | ys |
|
|
filterM1 | p xs x flg | = | filterM p xs >>= filterM0 flg x |
|
Cond Reductions:
The following Function with conditions
is transformed to
undefined0 | True | = undefined |
undefined1 | | = undefined0 False |
↳ HASKELL
↳ LR
↳ HASKELL
↳ IFR
↳ HASKELL
↳ BR
↳ HASKELL
↳ COR
↳ HASKELL
↳ Narrow
mainModule Monad
| (filterM :: (a -> Maybe Bool) -> [a] -> Maybe [a]) |
module Monad where
| import qualified Maybe import qualified Prelude
|
| filterM :: Monad a => (b -> a Bool) -> [b] -> a [b]
filterM | vw [] | = | return [] |
filterM | p (x : xs) | = | p x >>= filterM1 p xs x |
|
|
filterM0 | flg x ys | = | return (filterM00 x ys flg) |
|
|
filterM00 | x ys True | = | x : ys |
filterM00 | x ys False | = | ys |
|
|
filterM1 | p xs x flg | = | filterM p xs >>= filterM0 flg x |
|
module Maybe where
| import qualified Monad import qualified Prelude
|
Haskell To QDPs
↳ HASKELL
↳ LR
↳ HASKELL
↳ IFR
↳ HASKELL
↳ BR
↳ HASKELL
↳ COR
↳ HASKELL
↳ Narrow
↳ QDP
↳ QDPSizeChangeProof
Q DP problem:
The TRS P consists of the following rules:
new_gtGtEs(vz3, vz41, vz40, h) → new_filterM(vz3, vz41, h)
new_filterM(vz3, :(vz40, vz41), h) → new_gtGtEs(vz3, vz41, vz40, h)
R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem. From the DPs we obtained the following set of size-change graphs:
- new_gtGtEs(vz3, vz41, vz40, h) → new_filterM(vz3, vz41, h)
The graph contains the following edges 1 >= 1, 2 >= 2, 4 >= 3
- new_filterM(vz3, :(vz40, vz41), h) → new_gtGtEs(vz3, vz41, vz40, h)
The graph contains the following edges 1 >= 1, 2 > 2, 2 > 3, 3 >= 4